BASEOBJ=$(patsubst %.cpp, %.o, $(wildcard ./Base/*.cpp))
NETOBJ=$(patsubst %.cpp, %.o, $(wildcard ./Net/*.cpp))
CC=g++
INCLUDE=../include
TARGET=libnetwork

ARGS = CC="$(CC)" FLAG="$(FLAG)" INCLUDE="-I../$(INCLUDE)"

default: obj $(TARGET).a $(TARGET).so
	mv $(TARGET).a ../../lib/lib/
	mv $(TARGET).so ../../lib/dll/
obj:
	cd Base && make $(ARGS)
	cd Net && make $(ARGS)

$(TARGET).a : $(BASEOBJ) $(NETOBJ)
	ar -rc $@ $^

$(TARGET).so : $(BASEOBJ) $(NETOBJ)
	$(CC) -o $@ $^ -shared
	
clean:
	cd Base && make clean
	cd Net && make clean